//
//  KKSupplyCommodityItemList.m
//  FreightAssistant
//
//  Created by Mac mini on 15/12/16.
//  Copyright © 2015年 leo. All rights reserved.
//

#import "KKSupplyCommodityItemList.h"

@implementation KKSupplyCommodityItemList


@end


@implementation KKSupplyCommodityItem

- (instancetype)initWithItem:(KKCommodityItem *)item {
    
    if (item == nil) {
        return nil;
    }
    
    self = [super init];
    if (self) {
        
        _kk_commodityItem = [item copy];
        _kk_name = [item.kk_name copy];
        _kk_price = [item.kk_price copy];
        _kk_discount = @1.0;
        _kk_number = @1;
    }
    return self;
}

- (double)totalAmount {
    
    return _kk_price.doubleValue * _kk_number.doubleValue;
}

- (double)profitAmount {
    
    return _kk_price.doubleValue - _kk_commodityItem.kk_purchasePrice.doubleValue;
}

- (double)totalProfitAmount {
    
    return (_kk_price.doubleValue - _kk_commodityItem.kk_purchasePrice.doubleValue) * _kk_number.doubleValue;
}

@end